package com.softjourn.punchcard.merchant.lib;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PropertiesStorage {

	public static final String KEY_CLIENT_UID = "clientUid";

	public static final String KEY_SALEPOINT_UID = "salepointUid";
	
	public static final String KEY_OFFER_UID = "offerUid";
	
	public static final String KEY_PUNCHCARD_UID = "punchcardUid";

	public static final String KEY_PRODUCT_ID = "productId";

	// Shared Preferences
	SharedPreferences pref;

	// Editor for Shared preferences
	Editor editor;

	// Context
	Context context;

	int PRIVATE_MODE = 0;

	// Sharedpref file name
	private static final String PREF_NAME = "PunchCardMerchantPref";

	// Constructor
	public PropertiesStorage(Context context) {
		this.context = context;
		pref = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
		editor = pref.edit();
	}

	public void setActiveClient(String clientUid) {
		editor.putString(KEY_CLIENT_UID, clientUid);
		editor.commit();

	}

	public String getActiveClient() {

		return pref.getString(KEY_CLIENT_UID, null);
	}

	public void setActiveSalePoint(String salePointUid) {

		editor.putString(KEY_SALEPOINT_UID, salePointUid);
		editor.commit();
	}

	public String getActiveSalePoint() {
		return pref.getString(KEY_SALEPOINT_UID, null);
	}
	
	public void setActiveOffer(String offerUid) {

		editor.putString(KEY_OFFER_UID, offerUid);
		editor.commit();
	}

	public String getActiveOffer() {
		return pref.getString(KEY_OFFER_UID, null);
	}
	
	public void setActivePunchCard(String punchCardUid) {

		editor.putString(KEY_PUNCHCARD_UID, punchCardUid);
		editor.commit();
	}

	public String getActivePunchCard() {
		return pref.getString(KEY_PUNCHCARD_UID, null);
	}

	public void setActiveProduct(String productId) {

		editor.putString(KEY_PRODUCT_ID, productId);
		editor.commit();
	}

	public String getActiveProduct() {
		return pref.getString(KEY_PRODUCT_ID, null);
	}

}
